<?php

namespace App\Http\Controllers\Wechat;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Wechat\WelcomeRequest;
use App\Repositories\BLL\WelcomeBLL;

class WelcomeController extends Controller
{
    //
    private $welcomeBLL;
	
	function __construct(WelcomeBLL $welcome)
    {
        $this->welcomeBLL = $welcome;
    }
	
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
		
        $welcome = $this->welcomeBLL->getWelcome();
        return view('wechat.welcome.index',
						["welcome"=>$welcome]);
    }
	
	public function save(WelcomeRequest $request)
    {
        $result = $this->welcomeBLL->updateWelcome($request->all());
		
		if ($result) {
			flash('更新成功');
		}else{
			flash('更新失败','error');
		}
		
        return redirect(route('welcome.index'));
    }
}
